package com.atgion.manager.controller;

import com.atgion.manager.service.AdminTagService;
import com.atgion.spzx.model.vo.base.Result;
import com.atgion.spzx.model.vo.blog.AddTagReqVO;
import com.atgion.spzx.model.vo.blog.DeleteTagReqVO;
import com.atgion.spzx.model.vo.blog.QueryTagPageListReqVO;
import com.atgion.spzx.model.vo.blog.SearchTagReqVO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 犬小哈
 * @url: www.quanxiaoha.com
 * @date: 2023-04-19 16:06
 * @description: TODO
 **/
@RestController
@RequestMapping("/admin/tag")
public class AdminTagController {

    @Autowired
    private AdminTagService tagService;

    @PostMapping("/add")
    @Operation(description = "新增标签")
    public Result addTag(@RequestBody @Validated AddTagReqVO addTagReqVO) {
        return tagService.addTags(addTagReqVO);
    }

    @PostMapping("/list")
    @Operation(description = "获取标签列表分页数据")
    public Result queryTagPageList(@RequestBody QueryTagPageListReqVO queryTagPageListReqVO) {
        return tagService.queryTagPageList(queryTagPageListReqVO);
    }

    @PostMapping("/delete")
    @Operation(description = "删除标签")
    public Result deleteTag(@RequestBody @Validated DeleteTagReqVO deleteTagReqVO) {
        return tagService.deleteTag(deleteTagReqVO);
    }

    @PostMapping("/search")
    @Operation(description = "标签模糊查询")
    public Result searchTag(@RequestBody @Validated SearchTagReqVO searchTagReqVO) {
        return tagService.searchTags(searchTagReqVO);
    }

    @PostMapping("/select/list")
    @Operation(description = "获取所有标签下拉框数据")
    public Result queryTagSelectList() {
        return tagService.queryTagSelectList();
    }

}
